//
//  MyViewController.m
//  个人项目(豆瓣元旦作业)
//
//  Created by dllo on 15/12/31.
//  Copyright © 2015年 guoguo. All rights reserved.
//

#import "MyViewController.h"
#import "DengLuViewController.h"
#import "myMovieViewController.h"
#import "HGDataBase.h"

@interface MyViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic,retain) UITableView *tableView;
@end

@implementation MyViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = @"我的";
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:30/255.0 green:140/255.0 blue:200/255.0 alpha:0.7];
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
    
    //注册
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    
    
    
    //添加注销按钮
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"注销" style:UIBarButtonItemStylePlain target:self action:@selector(itemAction:)];
    
    self.navigationItem.rightBarButtonItem = item;
    
    

    
}

- (void)itemAction:(UIBarButtonItem *)item{
    
    DengLuViewController *dentlu = [[DengLuViewController alloc] init];
    
    [self.navigationController pushViewController:dentlu animated:YES];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    
    if (indexPath.row == 0) {
        cell.textLabel.text = @"我的活动";
    }
    if (indexPath.row ==1) {
        cell.textLabel.text = @"我的电影";
    }
    
    if (indexPath.row == 2) {
        cell.textLabel.text = @"我的缓冲";
    }
    
    
    return cell;
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 1) {
        
        myMovieViewController *mym = [[myMovieViewController alloc] init];
        
        NSArray *arr = [[HGDataBase sharedHGDataBase] selectData];
        
        mym.arr = arr;
        
        [self.navigationController pushViewController:mym animated:YES];
        
        
        
    }
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
